PATHMac OS 8 and 9 Developer Documentation > Interapplication Communication > AppleScript for Scripters >

AppleScript Language Guide

   

Case Sensitivity

AppleScript is not case sensitive; when it interprets statements in a script, it does not distinguish uppercase from lowercase letters. This is true for all elements of the language.

The one exception to this rule is string comparisons. Normally, AppleScript does not distinguish uppercase from lowercase letters when comparing strings, but if you want AppleScript to consider case, you can use a special statement called a Considering statement. For more information, see Considering and Ignoring Statements.

Most of the examples in this chapter and throughout this guide are in lower-case letters. Sometimes words are capitalized to improve readability. For example, in the following variable assignment, the "N" in myName is capitalized to make it easier to see that two words have been combined to form the name of the variable.

set myName to "Robin"

After you create the variable myName , you can refer to it by any of these names:

MYNAME
myname
MyName
mYName

However, when you first compile a script that capitalizes a variable name in different ways, AppleScript will convert the capitalization of all occurrences of the variable to match the capitalization of the first occurrence.

Although this guide uses variable names that start with a lower case letter and have initial upper case letters for subsequent words in the name ( myFileName ), some scripters prefer the form my_file_name .

When interpreting strings, such as "Robin" , AppleScript preserves the case of the letters in the string, but does not use it in comparisons unless directed to do so by a Considering statement. For example, the value of the variable myName defined earlier is "Robin" , but the value of the expression myName = "ROBIN" is true .


© 1999 Apple Computer, Inc. – (Last Updated 21 May 99)